package com.topisv.tms.service.stock.outstorage;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.topisv.tms.entity.EdiGoodsSku;
import com.topisv.tms.entity.stock.oustorage.OutstorageBillItem;
import com.topisv.tms.repository.EdiGoodsSkuDao;
import com.topisv.tms.repository.stock.outstorage.OutstorageBillItemDao;

/**
 * 出库单明细_service
 * @author ch
 *
 */
@Component
@Transactional(readOnly = true)
public class OutstorageBillItemService {
	
	@Autowired
	private OutstorageBillItemDao outstorageBillItemDao;
	@Autowired
	private EdiGoodsSkuDao ediGoodsSkuDao;
	
	public List<OutstorageBillItem> loadByBillCode(String billCode) {
		List<OutstorageBillItem> items = outstorageBillItemDao.loadByBillCode(billCode);
		for(OutstorageBillItem item : items){
			EdiGoodsSku ediGoodsSku = ediGoodsSkuDao.findByCustomerCodeAndSku(item.getCustomerCode(), item.getSku());
			if (ediGoodsSku != null) {
				item.setSkuName(ediGoodsSku.getSkuName());
			}
		}
		return items;
	}

	

}
